//
//  BIDNotifyViewController.m
//  商务厅
//
//  Created by mal on 13-12-9.
//  Copyright (c) 2013年 mal. All rights reserved.
//

#import "BIDOutingReportViewController.h"
#import "BIDCreateOutingReportViewController.h"
#import "BIDReceivedOutingReportViewController.h"
#import "BIDCollectionCellView.h"
#import "BIDSentOutingReportListViewController.h"

//角标
static NSString *outingReportBadgeNumberURL = @"outingAndroid!checkNew.action";

@interface BIDOutingReportViewController ()

@end

@implementation BIDOutingReportViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = @"外出报备";
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.title = @"外出报备";
    _menuArr = @[@{@"title":@"新建报备", @"imgName":@"leave_add.png"},
                 @{@"title":@"已收报备", @"imgName":@"leave_received.png"},
                 @{@"title":@"已发报备", @"imgName":@"leave_sent.png"}];
}

- (void)viewWillAppear:(BOOL)animated
{
    [self refreshBadge];
}

- (void)pushNotificationHandler
{
    [self refreshBadge];
}

//刷新角标
- (void)refreshBadge
{
    NSString *strPost = [[NSString alloc] initWithFormat:@"userId=%@", [AppDelegate getUserId]];
    NSDictionary *dictionary1 = @{@"index":@1, @"url":outingReportBadgeNumberURL, @"param_request":strPost, @"param_response":@"recvNotRead"};
    NSArray *arr = @[dictionary1];
    [self getCornerMarkCount:arr];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)backBtnHandler
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [self.navController popViewControllerAnimated:YES];
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger index = [indexPath row];
    switch (index)
    {
        case 0:
        {
            //新建报备
            BIDCreateOutingReportViewController *vc = [[BIDCreateOutingReportViewController alloc] initWithNibName:@"BIDCreateOutingReportViewController" bundle:nil];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 1:
        {
            //已收通知
            BIDReceivedOutingReportViewController *vc = [[BIDReceivedOutingReportViewController alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:
        {
            //已发通知
            BIDSentOutingReportListViewController *vc = [[BIDSentOutingReportListViewController alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
            
        default:
            break;
    }
}

@end
